package com.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import com.bean.User;
import com.utils.DateBase;

public class Login {
	public List<User> login(){
		User user = new User();
		List<User> list=new ArrayList<User>();
		Connection cnn = DateBase.getConnention();
		String sql = " select name,pwd from login ";
		PreparedStatement ps;
		try {
			ps = cnn.prepareStatement(sql);
			ResultSet rs = ps.executeQuery();
			
			while (rs.next()) {
				user = new User();
				user.setName(rs.getString("name"));
				user.setPwd(rs.getString("pwd"));
				list.add(user);
			}
			rs.close();
			ps.close();
			cnn.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}

}
